<div class="popup_body">
    <div class="ui_table">
        <form method="post">
            <input type="hidden" name="id" value="${(entity.id)!''}">
            <table cellpadding="0" cellspacing="0">
                <#if Session['SESSION_KEY_USER'].type == Session['USER_TYPE_PLATFORM'].value>
                    <tr>
                    <td align="right">运营商：</td>
                        <td>
                            <input name="agentId" class="easyui-combotree" editable="false"
                                   style="width: 200px; height: 28px;" id="agent_id" value="${(entity.agentId)!''}"
                                   data-options="url:'${contextPath}/security/basic/agent/tree.htm?',method:'get',onSelect: function(rec){
                                   var url = '${contextPath}/security/hdw/agency/tree.htm?agentId='+rec.id;
                                   $('#agency_id_${pid}').combotree('reload', url);},
                                   onChange:function(){
                                   $('#agency_id_${pid}').combotree('clear');
                                   }
                                   "/>
                        </td>
                    </tr>
                </#if>
                <#if Session['SESSION_KEY_USER'].type != Session['USER_TYPE_AGENCY'].value>
                    <tr>
                        <td width="80" align="right">代理商：</td>
                        <td>
                            <input name="agencyId" class="easyui-combotree" editable="false"
                                   style="width: 200px; height: 28px;" id="agency_id_${pid}"
                                   value="${(entity.agencyId)!''}"
                                   data-options="<#if Session['SESSION_KEY_USER'].agentId??&&Session['SESSION_KEY_USER'].agentId!=0>url:'${contextPath}/security/hdw/agency/tree.htm?agentId=${Session['SESSION_KEY_USER'].agentId}',</#if>method:'get'"
                            />
                        </td>
                    </tr>
                </#if>
                <tr>
                    <td width="70" align="right">押金(元)：</td>
                    <td><input id="forgift_money_${pid}" class="easyui-numberspinner" value="${((entity.forgiftMoney)/ 100)!''}"
                               style="width:200px;height: 30px" required="required"
                               data-options="min:0.00,precision:2">
                    </td>
                </tr>
                <tr>
                    <td align="right">状态：</td>
                    <td>
                                <span class="radio_box">
                                    <input type="radio" class="radio" name="status" id="status_1"
                                           <#if entity.status?? && entity.status == 1>checked</#if>
                                           value="1"/><label for="status_1">启用</label>
                                </span>
                                <span class="radio_box">
                                    <input type="radio" class="radio" name="status" id="status_0"
                                           <#if entity.status?? && entity.status == 1><#else>checked</#if>
                                           value="0"/><label for="status_0">禁用</label>
                                </span>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top" style="padding-top:10px;">备注：</td>
                    <td><textarea style="width:200px;" maxlength="220" name="notes">${(entity.notes)!''}</textarea></td>
                </tr>
            </table>
        </form>
    </div>
</div>
<div class="popup_btn">
    <button class="btn btn_red ok">确定</button>
    <button class="btn btn_border close">关闭</button>
</div>
<script>
    (function () {
        var pid = '${pid}',
                win = $('#' + pid),
                form = win.find('form');
        win.find('button.ok').click(function () {
            form.form('submit', {
                url: '${contextPath}/security/basic/customer_foregift/update.htm',
                onSubmit: function (param) {
                    var forgiftMoney = $('#forgift_money_${pid}').numberspinner('getValue');
                    param.forgiftMoney = parseInt(Math.round(forgiftMoney * 100));
                    return true;
                },
                success: function (text) {
                    var json = $.evalJSON(text);
                <@app.json_jump/>
                    if (json.success) {
                        $.messager.alert('提示信息', '操作成功', 'info');
                        win.window('close');
                    } else {
                        $.messager.alert('提示信息', json.message, 'info');
                    }
                }
            });
        });

        win.find('button.close').click(function () {
            win.window('close');
        });
    })()
</script>
